package icu.hsu.apisdk.service.impl;

import icu.hsu.apisdk.client.HsuApiClient;
import icu.hsu.apisdk.exception.ApiException;
import icu.hsu.apisdk.model.request.*;
import icu.hsu.apisdk.model.response.LoveResponse;
import icu.hsu.apisdk.model.response.PoisonousChickenSoupResponse;
import icu.hsu.apisdk.model.response.RandomWallpaperResponse;
import icu.hsu.apisdk.model.response.ResultResponse;
import icu.hsu.apisdk.service.ApiService;
import icu.hsu.apisdk.service.BaseService;
import lombok.extern.slf4j.Slf4j;

/**
 *  API服务的具体实现类，提供调用不同API的方法
 * @ClassName: ApiServiceImpl
 * @author Hsu琛君珩
 * @date 2024-09-08
 * @apiNote
 * @Version: v1.0
 */
@Slf4j
public class ApiServiceImpl extends BaseService implements ApiService {

    // 调用毒鸡汤API，无需提供客户端信息
    @Override
    public PoisonousChickenSoupResponse getPoisonousChickenSoup() throws ApiException {
        PoisonousChickenSoupRequest request = new PoisonousChickenSoupRequest();
        return request(request);
    }

    // 调用毒鸡汤API，使用提供的客户端信息
    @Override
    public PoisonousChickenSoupResponse getPoisonousChickenSoup(HsuApiClient hsuApiClient) throws ApiException {
        PoisonousChickenSoupRequest request = new PoisonousChickenSoupRequest();
        return request(hsuApiClient, request);
    }

    // 调用随机壁纸API，无需提供客户端信息
    @Override
    public RandomWallpaperResponse getRandomWallpaper(RandomWallpaperRequest request) throws ApiException {
        return request(request);
    }

    // 调用随机壁纸API，使用提供的客户端信息
    @Override
    public RandomWallpaperResponse getRandomWallpaper(HsuApiClient hsuApiClient, RandomWallpaperRequest request) throws ApiException {
        return request(hsuApiClient, request);
    }

    // 获取随机情话API，无需提供客户端信息
    @Override
    public LoveResponse randomLoveTalk() throws ApiException {
        LoveRequest request = new LoveRequest();
        return request(request);
    }

    // 获取随机情话API，使用提供的客户端信息
    @Override
    public LoveResponse randomLoveTalk(HsuApiClient hsuApiClient) throws ApiException {
        LoveRequest request = new LoveRequest();
        return request(hsuApiClient, request);
    }

    // 调用星座运势API
    @Override
    public ResultResponse horoscope(HoroscopeRequest request) throws ApiException {
        return request(request);
    }

    // 调用星座运势API，使用客户端信息
    @Override
    public ResultResponse horoscope(HsuApiClient hsuApiClient, HoroscopeRequest request) throws ApiException {
        return request(hsuApiClient, request);
    }

    // 获取IP信息
    @Override
    public ResultResponse getIpInfo(HsuApiClient hsuApiClient, IpInfoRequest request) throws ApiException {
        return request(hsuApiClient, request);
    }

    // 获取IP信息，无需提供客户端信息
    @Override
    public ResultResponse getIpInfo(IpInfoRequest request) throws ApiException {
        return request(request);
    }

    // 获取天气信息，使用客户端信息
    @Override
    public ResultResponse getWeatherInfo(HsuApiClient hsuApiClient, WeatherRequest request) throws ApiException {
        return request(hsuApiClient, request);
    }

    // 获取天气信息，无需提供客户端信息
    @Override
    public ResultResponse getWeatherInfo(WeatherRequest request) throws ApiException {
        return request(request);
    }
}
